<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			window.onload=function(){
				var add=document.getElementById("btn_add");
				var sub=document.getElementById("btn_sub");
				var f=document.getElementById("box");
				
				var font=16;
				
				//加字号
				add.onclick=function(){
					font++;
					f.style.fontSize=font+"px";
					console.log(font);
				}
				//减字号
				sub.onclick=function(){
					if(font>12){
						font--;
						f.style.fontSize=font+"px";
					}
					console.log(font);
				}
			}
		</script>
	</head>
	<body>
		<input type = "button" value = "A-" id="btn_sub"/>
		<input type = "button" value = "A+" id="btn_add"/>
		<div id="box">变变变</div>
	</body>
</html>
